/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/pascals-triangle-ii
   @Language: C++
   @Datetime: 19-08-09 11:55
   */

class Solution {
public:
	vector<int> getRow(int n) {
		vector<int> v(n+1,1);
		for(int f=n, i=0; i++<n/2; f=(long)f*(n-i)/(i+1))
			v[i]=v[n-i]=f;
		return v;
	}
};
